<?php
namespace app\api\validate;
use think\Validate;

/**
 * Class AdvertisementValidate
 * @package app\api\validate
 * @author zhenHong~
 * 广告-轮播图
 */
class AdvertisementValidate extends Validate{
    protected $rule = [
        'pic' => ['require'],
        'url' => ['require'],
        'sketch' => ['require'],
        'title' => ['require'],
        'province' => ['require','number'],
        'city' => ['require','number'],
        'area' => ['require','number'],
        'id' => ['require','number']
    ];

    protected $message = [
        'id'  => 'id参数错误',
        'pic' => '图片路径不能为空',
        'url' => '链接网址不能为空',
        'sketch' => '简述不能为空',
        'title' => '标题不能为空',
        'province' => '省不能为空',
        'city' => '市不能为空',
        'area' => '区不能为空'
    ];

    protected $scene = [
        //广告详情
        'adInfo' => ['id'],
        //删除广告
        'adDel' =>  ['id'],
        //广告列表
        'adList' => ['pageNum'],
        //添加广告轮播图
        'addAdPic' => ['title','sketch','url','position','province','city','area','pic'],
        //编辑广告轮播图
        'adEdit' => ['id','title','sketch','url','position','province','city','area','pic']
    ];
}